package com.example.testapplication.ui.userdata;

import android.app.Application;
import android.graphics.Color;
import android.net.Uri;
import android.text.TextUtils;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableField;

import com.example.testapplication.ui.imageselect.ImagePreviewActivity;
import com.example.testapplication.ui.login.LoginFragmentViewModel;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.core.ImageViewerPopupView;
import com.lxj.xpopup.interfaces.OnSrcViewUpdateListener;
import com.lxj.xpopup.util.SmartGlideImageLoader;

import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand;
import me.goldze.mvvmhabit.bus.event.SingleLiveEvent;

public class UserDataVewModel extends BaseViewModel {

    //用户名的绑定
    public ObservableField<String> avatar = new ObservableField<>("");
    //密码的绑定
    public ObservableField<String> nickName = new ObservableField<>("");
    public UserDataVewModel(@NonNull Application application) {
        super(application);
    }

    //封装一个界面发生改变的观察者
    public UIChangeObservable uc = new UIChangeObservable();



    public class UIChangeObservable {
        //点击事件观察者
        public SingleLiveEvent<Integer> pClickEvent = new SingleLiveEvent<>();
    }



    public BindingCommand onClickAvatarCommand = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            uc.pClickEvent.setValue(1);
        }
    });

    public BindingCommand onClickAvatarLayoutCommand = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            uc.pClickEvent.setValue(2);
        }
    });

    public BindingCommand onClickNameCommand = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            uc.pClickEvent.setValue(3);
        }
    });

    public BindingCommand onClickAddressCommand = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            uc.pClickEvent.setValue(4);
        }
    });

    public BindingCommand onTitlebarLeftCommand = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            finish();
        }
    });

}
